﻿<telerik:RadWindow xmlns:my="clr-namespace:ProTemplate.UserControls"  x:Class="ProTemplate.UserControls.RadWindows.AddCustomer"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                   xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                   xmlns:input="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input"
    mc:Ignorable="d" Width="650" Height="400" Closed="RadWindow_Closed" FontFamily="SimHei"
    d:DesignHeight="230" d:DesignWidth="350" Header="新增客户" Style="{StaticResource CommonRadWindowStyle}" telerik:Theming.Theme="Office_Blue" WindowStartupLocation="CenterScreen">
    <telerik:RadWindow.Resources>
        <Style TargetType="TextBlock" x:Key="AddDeclarationLabel">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="Width" Value="70" />
            <Setter Property="FontFamily" Value="SimHei" />
        </Style>

        <Style TargetType="TextBox" x:Key="AddDeclarationInputBox">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="Width" Value="460" />
            <Setter Property="FontFamily" Value="SimHei" />
        </Style>

        <Style TargetType="TextBox" x:Key="AddDeclarationInputBoxShort">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="Width" Value="220" />
            <Setter Property="FontFamily" Value="SimHei" />
        </Style>

        <Style TargetType="input:AutoCompleteBox" x:Key="AddDeclarationAutoCompleteBoxStyle">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="Width" Value="460" />
            <Setter Property="FontFamily" Value="SimHei" />
        </Style>
    </telerik:RadWindow.Resources>
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="40" />
            <RowDefinition Height="*" />
            <RowDefinition Height="30" />
        </Grid.RowDefinitions>
        <my:EditWindowToolBar x:Name="toolBar" Grid.Row="0" SaveAndClose="EditWindowToolBar_SaveAndClose" SaveAndNew="EditWindowToolBar_SaveAndNew" Close="EditWindowToolBar_Close"/>
        <Grid Grid.Row="1" >
            <telerik:RadTabControl telerik:Theming.Theme="Office_Blue">
                <telerik:RadTabItem>
                    <telerik:RadTabItem.Header>
                        <TextBlock Text="基本信息" />
                    </telerik:RadTabItem.Header>
                    <telerik:RadTabItem.Content>
                        <Grid >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="100" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="30" />
                                <RowDefinition Height="30" />
                                <RowDefinition Height="30" />
                                <RowDefinition Height="30" />
                                <RowDefinition Height="30" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <TextBlock Text="客户名称:" Style="{StaticResource WindowInputLabel}"  />
                            <TextBox Grid.Column="1" Name="tbName" Style="{StaticResource WindowInput}" MaxLength="64" Text="{Binding Name, Mode=TwoWay, ValidatesOnExceptions=True, NotifyOnValidationError=True,UpdateSourceTrigger=Explicit}" />
                            <TextBlock Grid.Row="1" Text="地址:" Style="{StaticResource WindowInputLabel}"  />
                            <TextBox Grid.Row="1" Grid.Column="1" Name="tbAddress" Style="{StaticResource WindowInput}" MaxLength="128" Text="{Binding Address, Mode=TwoWay,UpdateSourceTrigger=Explicit}" />
                            <TextBlock Grid.Row="2" Text="电话:" Style="{StaticResource WindowInputLabel}"  />
                            <TextBox Grid.Row="2" Grid.Column="1" Name="tbPhone" MaxLength="30" Style="{StaticResource WindowInput}" Text="{Binding PhoneNumber, Mode=TwoWay,UpdateSourceTrigger=Explicit}" />
                            <TextBlock Grid.Row="3" Text="老板:" Style="{StaticResource WindowInputLabel}"  />
                            <ComboBox x:Name="cbBoss" Grid.Row="3" Grid.Column="1" Style="{StaticResource WindowCombobox}" ItemsSource="{Binding Items, Source={StaticResource BossViewModel}}" DisplayMemberPath="Name" />
                            <CheckBox x:Name="cbIsValid" Content="是否有效" IsChecked="{Binding IsActive, Mode=TwoWay,UpdateSourceTrigger=Explicit}" Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="35,0,0,0" FontSize="14" />
                        </Grid>
                    </telerik:RadTabItem.Content>
                </telerik:RadTabItem>
                <telerik:RadTabItem Header="费用">
                    <telerik:RadTabItem.Content>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"></RowDefinition>
                                <RowDefinition Height="30"></RowDefinition>
                            </Grid.RowDefinitions>
                            <telerikGridView:RadGridView Name="lvwFeeType" telerik:Theming.Theme="Office_Blue" Style="{StaticResource CommonRadGridView}" ShowGroupPanel="False" SelectionMode="Single"
                                  SelectionChanged="lvwFeeType_SelectionChanged"    >
                                <telerikGridView:RadGridView.Columns>
                                    <telerik:GridViewDataColumn Header="序号" DataMemberBinding="{Binding Index}" IsFilterable="False" />
                                    <telerik:GridViewDataColumn Header="费用类型" DataMemberBinding="{Binding Name}" IsFilterable="False" Width="100" />
                                    <telerik:GridViewDataColumn Header="费用" DataMemberBinding="{Binding Amount}" IsFilterable="False" Width="80" />
                                    <telerik:GridViewDataColumn Header="成本" DataMemberBinding="{Binding Cost}" IsFilterable="False" Width="80" />
                                </telerikGridView:RadGridView.Columns>
                            </telerikGridView:RadGridView>
                            <StackPanel Orientation="Horizontal" Grid.Row="1">
                                <TextBlock Text="费用类型：" Margin="0,0" Width="60" Style="{StaticResource AddDeclarationLabel}" />
                                <input:AutoCompleteBox x:Name="acbFeeType" Width="60" 
                                                   Style="{StaticResource AddDeclarationAutoCompleteBoxStyle}" FilterMode="None" Populating="acbFeeType_Populating" ValueMemberPath="Name" SelectionChanged="acbFeeType_SelectionChanged" >
                                    <input:AutoCompleteBox.ItemTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding Name}" />
                                        </DataTemplate>
                                    </input:AutoCompleteBox.ItemTemplate>
                                </input:AutoCompleteBox>
                                <TextBlock Text="费用：" Margin="15,0" Width="30" Style="{StaticResource AddDeclarationLabel}" />
                                <TextBox x:Name="tbAmount" Style="{StaticResource AddDeclarationInputBox}" Width="60" MaxLength="32" Text="{Binding Amount, ValidatesOnExceptions=True, NotifyOnValidationError=True,UpdateSourceTrigger=Explicit}" />
                                <TextBlock Text="成本：" Margin="15,0" Width="30" Style="{StaticResource AddDeclarationLabel}" />
                                <TextBox x:Name="tbCost" Style="{StaticResource AddDeclarationInputBox}" Width="60" MaxLength="32" Text="{Binding Cost, ValidatesOnExceptions=True, NotifyOnValidationError=True,UpdateSourceTrigger=Explicit}" />

                                <Button x:Name="btnAddFeeType"  Width="55" VerticalAlignment="Center" Height="20" Margin="10,0" Content="添加" Click="btnAddFeeType_Click" />
                                <Button x:Name="btnUpdateFeeType"  Width="55" VerticalAlignment="Center" Height="20" Margin="10,0" Content="更新" Click="btnUpdateFeeType_Click"  />
                                <Button x:Name="btnDeleteFeeType"  Width="55" VerticalAlignment="Center" Height="20" Content="删除" Click="btnDeleteFeeType_Click"   />
                            </StackPanel>
                        </Grid>
                    </telerik:RadTabItem.Content>
                </telerik:RadTabItem>
            </telerik:RadTabControl>
        </Grid>
        <Border x:Name="bdMsgParent" Grid.Row="2" Grid.ColumnSpan="2" HorizontalAlignment="Right" Margin="0,8,10,0">

        </Border>
        <Border Grid.RowSpan="3">
            <telerik:RadBusyIndicator x:Name="busyIndicator" DisplayAfter="0" IsBusy="False" BusyContent="正在处理，请稍候..." />
        </Border>
    </Grid>
</telerik:RadWindow>
